var t = getApp();

Page({
    data: {
        stock_id: "",
        list: [],
        page: 1,
        total_page: 1
    },
    onLoad: function(t) {
        t.id && (this.setData({
            stock_id: t.id
        }), this.getData({
            stock_id: t.id
        }));
    },
    getMoreData: function() {
        if (!(this.data.page >= this.data.total_page)) {
            var t = {
                stock_id: this.data.stock_id,
                page: this.data.page + 1
            };
            this.getData(t);
        }
    },
    getData: function(a) {
        var o = this;
        t._postNetWork({
            url: t.getNetAddresss("plugin.store-cloud-stock.frontend.controllers.home.logs"),
            data: a,
            success: function(a) {
                var e = a.data, s = e.result, n = e.msg, i = e.data, c = i.current_page, d = i.last_page, g = i.data;
                if (0 == s) return t.tips(n);
                o.setData({
                    page: c,
                    total_page: d
                }), 1 == c ? o.setData({
                    list: g || []
                }) : o.setData({
                    list: o.data.list.concat(g)
                });
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.getMoreData();
    },
    onShareAppMessage: function() {}
});